home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / dos / pascal / getopt.exe / README.DOC < prev    next >
Text File  |  1993-04-08  |  1KB  |  36 lines

  1. March 8, 1993
  2.  
  3. GETOPT_.PAS & GETOPT2_.PAS
  4. A port from BorlandC's GETOPT.C made by Juancarlo Anez, CIS[73000,1064]
  5.  
  6. Both units are very simple and autodocumented, so take a look at them.
  7.  
  8. GETOPT_.PAS   is the almost direct port.  It lets you define and recognize
  9. normal switches and switches with arguments (like in PKZIP -bc:\tmp).
  10.  
  11. GETOPT_2.PAS is the one I preffer.  In this one, you only define switches
  12. that need arguments, so every '/x' sequence in the command line makes
  13. getopt return 'x' as a valid switch.  Errors (invalid or not recognized
  14. switches) are then handled by the caller.
  15.  
  16. Both units will return switch and non switch arguments.  This is different
  17. from standard getotp, but I think it's better.  You can ignore non-switches
  18. if you like.
  19.  
  20. Both units leave the number of non swith arguments in the variable ArgC,
  21. and pointers to this arguments in the array ArgV[].  This lets you process
  22. switches first, and then carry on with non switch arguments.
  23.  
  24. The test program uses one or the other unit depending on the definition
  25. of the OPT2 define.  If you wan't to try GETOPT2_, then put
  26.  
  27. {$DEFINE OPT2}
  28.  
  29. as the first line in your program.  If you wan't to try GETOPT_, then
  30. don't define OPT2.  That's all.
  31.  
  32. Run TESTO.BAT for a demo of assorted switches.
  33.  
  34. Feel free to e-mail or post in GO BPASCAL any bugs or comments.
  35.  
  36. Enjoy.  -(j)